<template>

    <CommonContainer title="免信审规则">
        <el-table
            :data="noCreditRecords"
            :header-cell-style="{ background: '#FAFAFA', color: '#000000' }" border>
            <el-table-column
                align="center"
                prop="ruleName"
                label="规则名称"
                min-width="120">
            </el-table-column>
            <el-table-column
                align="center"
                prop="planName"
                label="产品方案"
                show-overflow-tooltip
                min-width="120">
            </el-table-column>
            <el-table-column
                align="center"
                label="业务类型"
                min-width="120">
                <template v-slot="{row}">
                    <dict-tag
                        :options="dict.type.business_type"
                        :value="row.businessType"/>
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                prop="status"
                label="客户类型"
                min-width="120">
                <template v-slot="{row}">
                    <dict-tag
                        :options="dict.type.customer_type"
                        :value="row.customerType"/>
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                prop="createTime"
                label="租赁用途"
                min-width="120">
                <template v-slot="{row}">
                    <dict-tag
                        :options="dict.type.rental_purpose"
                        :value="row.leasePurpose"/>
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                label="客户标签"
                min-width="120">
                <template v-slot="{row}">
                    <dict-tag
                        :options="dict.type.customer_label"
                        :value="row.customerSource"/>
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                label="客户等级"
                min-width="120">
                <template v-slot="{row}">
                    <dict-tag
                        :options="dict.type.customer_level"
                        :value="row.customerGrade"/>
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                label="客户属性"
                min-width="120">
                <template v-slot="{row}">
                    <dict-tag
                        :options="dict.type.customer_property"
                        :value="row.clientProperty"/>
                </template>
            </el-table-column>
            <el-table-column
                v-if="noCreditRecordObject.unitsStatus == 1"
                align="center"
                prop="createTime"
                min-width="120">
                <template slot="header">
                    <div>
                            <span v-if="noCreditRecordObject.unitsType<3">
                                 <dict-tag
                                     :options="dict.type.credit_review_units"
                                     :value="noCreditRecordObject.unitsType"/>
                            </span>
                        <span v-else-if="noCreditRecordObject.unitsType<5">
                                 {{ noCreditRecordObject.unitsDays }}<dict-tag
                            :options="dict.type.credit_review_units"
                            :value="noCreditRecordObject.unitsType"/>
                            </span>
                        <span v-else>
                                --
                            </span>
                    </div>
                </template>
                <template v-slot="{row}">
                    {{ `[${row.minUnits || '--'},${row.maxUnits || '--'}]` }}
                </template>
            </el-table-column>
            <el-table-column
                v-if="noCreditRecordObject.amountStatus == 1"
                align="center"
                min-width="120">
                <template slot="header">
                        <span v-if="noCreditRecordObject.amountType<3">
                             <dict-tag
                                 :options="dict.type.credit_review_amount"
                                 :value="noCreditRecordObject.amountType"/>
                        </span>
                    <span v-else-if="noCreditRecordObject.amountType<5">
                             {{ noCreditRecordObject.amountDays }}<dict-tag
                        :options="dict.type.credit_review_amount"
                        :value="noCreditRecordObject.amountType"/>
                        </span>
                    <span v-else>
                                --
                            </span>
                </template>
                <template v-slot="{row}">
                    {{ `[${row.minAmount || '--'},${row.maxAmount || '--'}]` }}
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                label="租期"
                min-width="120">
                <template v-slot="{row}">
                    {{ `[${row.minLeaseTerm || '--'},${row.maxLeaseTerm || '--'}]` }}
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                label="创建时间"
                prop="createTime"
                min-width="120">
            </el-table-column>
        </el-table>
    </CommonContainer>

</template>

<script>

export default {
    dicts: ['customer_type', 'business_type', 'rental_purpose', 'customer_level', 'customer_property', 'customer_label', 'credit_review_units', 'credit_review_amount'],
    components: {},
    props: {
        noCreditRecords: {
            type: Array,
            default: () => {
                return []
            }
        }
    },
    data() {
        // 这里存放数据
        return {
            noCreditRecordObject: {}
        }
    },
    computed: {},
    // 方法集合
    methods: {},
    // 生命周期 - 挂载完成（可以访问 DOM 元素）
    mounted() {
        this.noCreditRecordObject = this.noCreditRecords[0] ?? {}
    },

}
</script>

<style lang="scss" scoped>
.subTitle {
    font-size: 14px;
    font-weight: 500;
    color: #464646;
}
</style>
